<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'docedt.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  <SCRIPT src="js/jquery.js" type="text/javascript"></SCRIPT>
  <script type="text/javascript">
   $(document).ready(function(){
                        $.getJSON("type.do?method=getAllKb", function(data){
                            if (data.length != 0) {
								//清空
                                $("#kb").html("<option value=''>请选择科别</option>");
                                for (i = 0; i < data.length; i++) {
									//追加option
                                    $("#kb").append("<option value=" + data[i].kb_name + ">" + data[i].kb_name + "</option>");
                                }
                            }
                        });
                        });
                        
                        function doCheck(){
                        var email = document.AddForm.docemail.value;   // 邮箱
                        var phone = document.AddForm.docphone.value;   // 电话号码
                        var pwd1 = document.AddForm.docpass.value;		 // 密码
                        var docname = document.AddForm.docname.value;	//医生名
                        var docposname = document.AddForm.docposname.value;//医生职称
                        if(docname==""||docposname==""){
                        	alert("姓名或医生职称不能为空！");
                        		return false;
                        }
                        	
                        if(!verfifyEmail(email)){
							alert("请输入正确的e-mail地址!");
							 return false;
							}
							
						if (!isMobil(phone)||phone==""){
							alert("请输入正确的手机号码！");
						 	return false;
						 }
						 
						 if(!isPasswd(pwd1)){
							alert("密码只能是6-20个字母、数字、下划线");
							return false; 
							}
						 
						 return true;
					
                       }
                       
                       function verfifyEmail(strEmail){
							var CheckMail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
							 if (!CheckMail.test(strEmail))
							 {
							  return false;
							 }else{
							 return true;
							 }
						}
						
						
						 function isMobil(object) {
				            var reg0 = /^13\d{5,9}$/;
				            var reg1 = /^15\d{5,9}$/;
				            var reg4 = /^18\d{5,9}$/;
				            var reg3 = /^0\d{10,11}$/;
				            var my = false;
				            if (reg0.test(object))my=true;
				            if (reg1.test(object))my=true;
				            if (reg3.test(object))my=true;
				            if (reg4.test(object))my=true;
				                if(object!="")
				                {
				                    if (!my)
				                    {
				                    return false;
				                    }
				                }
				                return true;
            				}
            				function isPasswd(s) { 
								var patrn=/^(\w){6,20}$/; 
								if (!patrn.exec(s)) 
									return false; 
								return true; 
							}
  
  </script>
  </head>
  
  <body class="ContentBody">
  <form action="doctor.do?method=addDoc" method="post"  name="AddForm">
<div class="MainDiv">
<table width="99%" border="0" cellpadding="0" cellspacing="0" class="CContent" bgcolor="#eefbfe">
  <tr>
      <th class="tablestyle_title" >添加医生</th>
  </tr>
  <tr>
    <td class="CPanel">
		
		<table border="0" cellpadding="0" cellspacing="0" style="width:100%">
		<TR>
			<TD width="100%">
				<fieldset style="height:100%;">
				<legend>医生</legend>
					  <table border="0" cellpadding="2" cellspacing="1" style="width:100%">
					 
					  <tr>
					    <td nowrap align="right" width="13%">医生姓名:</td>
					    <td width="41%"><input name="docname" class="text"  type="text"  />
				       </td>
					    <td align="right" width="19%">性别:</td>
					    <td width="27%">&nbsp;男<input name="docsex" value="男"  type="radio" checked/>
					   	女<input name="docsex" value="女" type="radio"/>
					    </td>
					    </tr>
					  <tr>
					    <td nowrap align="right">电子邮件:</td>
					    <td><input name="docemail" id="" class="text" style="width:154px" /></td>
					    <td align="right">医生职称:</td>
					    <td><input name="docposname" id="Input" class="text" style="width:154px" /></td>
					  </tr>
					   <tr>
					    <td nowrap align="right">主治专科:</td>
					    <td>
					   	<span class="kebie" id="kbs"> <SELECT id="kb"	name="docattend">
							<option value="">
									请选择科别
							</option>
						</SELECT></span> </td>
					   <td align="right">医生密码:</td>
					    <td><input type="password" name="docpass" id="Input" class="text" style="width:154px" /></td>
					  </tr>
					  <tr>
					    <td nowrap align="right">医生电话:</td>
					    <td><input maxlength="11" name="docphone" id="" class="text" style="width:154px" onkeydown="if(event.keyCode==13)event.keyCode=9" onkeypress="if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false"/></td>
					  </tr>
					  <tr>
					    <td nowrap align="right" height="120px">医生详细信息:</td>
					    <td colspan="3"><textarea id="textarea" name="docinfo" rows="8" cols="80"></textarea></td>
					  </tr>
					  </table>
			 	<br />
				</fieldset>			</TD>
		</TR>
		
		</TABLE>
	
	
	 </td>
  </tr>
		
		<TR>
			<TD colspan="2" align="center" height="50px">
			<input type="submit"  value="添加"  onclick="return doCheck()"/>　
		</TD>
		</TR>
		</TABLE>

</div>
</form>
</body>
</html>
